package com.gxa.controller.fwgl.yhgl;

import com.gxa.pojo.dto.fwgl.CheckInDto;
import com.gxa.pojo.dto.fwgl.OldInfoDto;
import com.gxa.pojo.entity.fwgl.TCheckIn;
import com.gxa.pojo.entity.fwgl.TOldinfo;
import com.gxa.service.fwgl.yhgl.CheckInService;
import com.gxa.service.fwgl.yhgl.OldInfoService;
import com.gxa.utils.QueryResult;
import com.gxa.utils.Result;
import com.gxa.utils.ResultUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author：lizhijun
 * @Package：{PROJECT_NAME}
 * @name：{DATE} {NAME}
 */
@RestController
@RequestMapping("/checkin")
public class CheckInController {
    @Resource
    private CheckInService checkInService;

    @GetMapping("/queryAll")
    public Result queryAll(CheckInDto checkInDto){
        System.out.println("checkInDto:------------"+checkInDto);
        QueryResult queryResult = checkInService.queryAll(checkInDto);

        return ResultUtils.buildSuccess(queryResult.getData(),queryResult.getCount());
    }

    @RequestMapping("/add")
    public Result addCheckIn(TCheckIn checkIn){
        checkInService.add(checkIn);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/update")
    public Result updateCheckIn(TCheckIn checkIn){
        checkInService.update(checkIn);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/delete")
    public Result deleteCheck(Integer id){
        checkInService.delete(id);
        return ResultUtils.buildSuccess();
    }

    @RequestMapping("/find")
    public Result findTypeByName(String patientName){
        checkInService.findByName(patientName);
        return ResultUtils.buildSuccess();
    }
}
